package com.luojing.innerclass.controllerframework;

import com.luojing.innerclass.controllerframework.GreenHouseControls.Terminate;

/**
 * @author luojing
 * @create 2018/09/08 下午1:42
 **/
public class GreenHouseController {

  public static void main(String[] args) {
    GreenHouseControls greenHouseControls = new GreenHouseControls();
    greenHouseControls.addEvent(greenHouseControls.new Bell(9000));

    Event[] events = {
        greenHouseControls.new ThermostatNight(0),
        greenHouseControls.new LightOn(2000),
        greenHouseControls.new LightOff(4000),
        greenHouseControls.new WaterOn(6000),
        greenHouseControls.new WaterOff(8000),
        greenHouseControls.new ThermostatDay(14000)

    };

    greenHouseControls.addEvent(greenHouseControls.new Restart(20000,events));
    if(args.length == 1){
      greenHouseControls.addEvent(new Terminate(new Integer(args[0])));
    }
    greenHouseControls.run();
  }

}
